clear all
close all
load('modeldata_endosearch_v8_restricted_samearrival_samesig_final_100K_b1.mat')
hold off
close all

date2 = linspace(1,capT2*2,capT2*2)
h1 = figure(1)
plot(date2,gendergap_dat(1:1:capT2*2),'k-.',date2,cumcomp_m(1:1:capT2*2)./cumcomp_f(1:1:capT2*2),'k-o','Linewidth',2)
ylabel('gender gap','Fontsize',14)
xlabel('month','Fontsize',14) 
legend('data','model','Fontsize',14)
ylim([1.1 1.17])
xlim([1 21])
print -depsc2 figures/figF1a.eps



h2 = figure(2)
plot(date2(1:capT2*2),cumsum_m_dat(1:capT2*2),'b-.',date2(1:1:capT2*2),cumulsum_m(1:1:capT2*2),'b',...
    date2(1:1:capT2*2),cumsum_f_dat(1:1:capT2*2),'r-.',date2(1:1:capT2*2),cumulsum_f(1:1:capT2*2),'r','Linewidth',2)
ylabel('cumulative share accepted','Fontsize',14)
xlabel('month','Fontsize',14) 
legend('data-men','model-men','data-women','model-women','Fontsize',14)
xlim([1 21])    
print -depsc2 figures/figF1b.eps














bias_f      = (exp(mu0_f+sigstar_f^2/2)-exp(mustar_f+sigstar_f^2/2))./exp(mustar_f+sigstar_f^2/2) ;
bias_m      = (exp(mu0_m+sigstar_m^2/2)-exp(mustar_m+sigstar_m^2/2))./exp(mustar_m+sigstar_m^2/2) ;

bias_f_grad      = (expected_off_f(10)-exp(mustar_f+sigstar_f^2/2))./exp(mustar_f+sigstar_f^2/2) ;
bias_m_grad      = (expected_off_m(10)-exp(mustar_m+sigstar_m^2/2))./exp(mustar_m+sigstar_m^2/2) ;

FID=fopen('figures/tableF1.tex','w+') 
fprintf(FID, '\\begin{center} \n') ;
fprintf(FID, '\\begin{threeparttable} \n') ;
fprintf(FID, '\\begin{tabular}{llcc}   \n') ;
fprintf(FID,' Parameter & Description & \\multicolumn{2}{c}{Value} \\\\ \\hline \\hline  \n ') ;
fprintf(FID,'  & & &     \\\\  \n ') ;
fprintf(FID,' $\\beta$ & discount rate &  \\multicolumn{2}{c}{%8.3f}    \\\\  \n ' , [bet]) ;
fprintf(FID,' $\\sigma^{\\ast}$ & variance log offer &  \\multicolumn{2}{c}{%8.3f}   \\\\  \n ' , [sigstar_m(1) ]) ;
% fprintf(FID,' $\\lambda$ & search efficiency, men &  \\multicolumn{2}{c}{%8.3f}  \\\\  \n ' , [lam_m]) ;
%fprintf(FID,'  &  &  \\multicolumn{2}{c}{(%8.3f)}    \\\\  \n ' , [std(x_m_std(1,1,:),'omitnan')]) ;
% fprintf(FID,' $\\mu^{\\ast}$ & mean log offer, men &  \\multicolumn{2}{c}{%8.3f}   \\\\  \n ' , [mustar_m(1) ]) ;
%fprintf(FID,'  &  &  \\multicolumn{2}{c}{(%8.3f)}    \\\\  \n ' , [std(mustar_m_std(1,1,:),'omitnan')]) ;
%fprintf(FID,' $\\zeta$ & cost of no job &  \\multicolumn{2}{c}{%8.3f}  \\\\  \n ' , [zeta_m(1) ]) ;
%fprintf(FID,'  &  &  \\multicolumn{2}{c}{(%8.3f)}    \\\\  \n ' , [std(zeta_m_std,'omitnan')]) ;
fprintf(FID,' $\\phi$ & mean cost of search (utils) &  \\multicolumn{2}{c}{%8.3f}  \\\\  \n ' , [1./scost_m(1) ]) ;
%fprintf(FID,'  &  &  \\multicolumn{2}{c}{(%8.3f)}    \\\\  \n ' , [std(phi_m_std,'omitnan')]) ;
fprintf(FID,' $b$ & value of leisure &  \\multicolumn{2}{c}{%8.3f}   \\\\ \n ' ,[b_m(1) ] ) ;
%fprintf(FID,'  &  &  \\multicolumn{2}{c}{(%8.3f)}    \\\\  \n ' , [std(b_m_std,'omitnan')]) ;
fprintf(FID,' $\\lambda$ & returns to search &  \\multicolumn{2}{c}{%8.3f}   \\\\ \n ' ,[lam_m(1) ] ) ;
%fprintf(FID,'  &  &  \\multicolumn{2}{c}{(%8.3f)}    \\\\  \n ' , [std(b_m_std,'omitnan')]) ;
fprintf(FID,'  & &   &   \\\\  \n ') ;
fprintf(FID,'  &  & Men & Women \\\\ \\hline \\hline  \n ') ;
fprintf(FID,' $\\mu^{\\ast}$ & mean log offer&  %8.3f &  %8.3f \\\\  \n ' , [mustar_m mustar_f]) ;
%fprintf(FID,'  &  &  (%8.3f) & (%8.3f)   \\\\  \n ' , [std(mu_m_std,'omitnan') std(mu_f_std,'omitnan') ]) ;
%fprintf(FID,' $\\sigma^{\\ast}$ & std log offer&  %8.3f &  %8.3f \\\\  \n ' , [sigstar_m sigstar_f]) ;
%fprintf(FID,'  &  &  (%8.3f) & (%8.3f)   \\\\  \n ' , [std(mu_m_std,'omitnan') std(mu_f_std,'omitnan') ]) ;
fprintf(FID,' $\\mu$ & expected log offer &  %8.3f &  %8.3f \\\\  \n ' , [mu0_m mu0_f]) ;
%fprintf(FID,'  &  &  (%8.3f) & (%8.3f)   \\\\  \n ' , [std(mu_m_std,'omitnan') std(mu_f_std,'omitnan') ]) ;
fprintf(FID,' $ $ & $\\Longrightarrow $implied bias in wages (percent dev.) at graduation &  %8.3f &  %8.3f \\\\  \n ' , 100*[(expected_off_m(10)-lognstat(mustar_m,sigstar_m))./(lognstat(mustar_m,sigstar_m)) (expected_off_f(10)-lognstat(mustar_f,sigstar_f))./(lognstat(mustar_f,sigstar_f))]) ;
fprintf(FID,' $\\iota$ & risk aversion &  %8.3f &  %8.3f \\\\  \n ' , [iota_m iota_f]) ;
%fprintf(FID,'  &  &  (%8.3f) & (%8.3f)   \\\\  \n ' , [std(iota_m_std,'omitnan') std(iota_f_std,'omitnan')]) ;
fprintf(FID,' $\\gamma$ & learning rate &  %8.3f &  %8.3f \\\\  \n ' , [gam_m(1) gam_f(1)]) ;
% fprintf(FID,'  &  &  (%8.3f) & (%8.3f)   \\\\  \n ' , [std(gam_m_std,'omitnan') std(gam_f_std,'omitnan') ]) ;
fprintf(FID,'  & &   &   \\\\  \n ') ;
fprintf(FID,'\\hline \n') ;
fprintf(FID,'\\end{tabular} \n') ;
% fprintf(FID,'\\begin{tablenotes} \n')
% fprintf(FID,'\\footnotesize \n')
% fprintf(FID,'\\item Notes. The discount rate is set ex ante, while the remaining parameters are estimated from the corresponding moments in our data. \n')
% fprintf(FID,'\\end{tablenotes} \n')
fprintf(FID, '\\end{threeparttable} \n') ;
fprintf(FID, '\\end{center} \n') ;
fclose(FID) ;

